import { get } from '@feidao-factory/send-msg/browser/request';
import global from '../../core/global';

export interface IClientInfo {
	area: string;
	area_id: string;
	city: string;
	city_id: string;
	country: string;
	country_id: string;
	ip: string;
	isp_id: string;
	region_id: string;
	region: string;
	county: string;
	isp: string;
}

/**
 * 获取客户端信息
 * @param url  请求地址
 * @return IClientInfo
 * @example const res=await get_client_info();
 */
export default async function get_client_info() {
	const url = `${global.host}/get-client-info`;
	const res = await get(url);
	return JSON.parse(res.responseText) as IClientInfo;
}
